<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<%@ page import="com.msmall.base.util.ConstantDB" language="java"%>
<c:set var="AVALIABLE" value="<%=ConstantDB.AVALIABLE%>"></c:set>
<c:set var="UNAVALIABLE" value="<%=ConstantDB.UNAVALIABLE%>"></c:set>
<c:set var="REPLY" value="<%=ConstantDB.REPLY%>"></c:set>
<c:set var="UNREPLY" value="<%=ConstantDB.UNREPLY%>"></c:set>
<c:set var="REPLY" value="<%=ConstantDB.REPLY%>"></c:set>
<c:set var="UNREPLY" value="<%=ConstantDB.UNREPLY%>"></c:set>
<c:set var="FROM_TRANSFER" value="<%=ConstantDB.FROM_TRANSFER%>"></c:set>
<c:set var="FROM_ORIGINAL" value="<%=ConstantDB.FROM_ORIGINAL%>"></c:set>

<div class="ntopic">
	<div class="ntopic_auther">
		将您的问题告诉我们，我们一起解决。
	</div>
	<form id="f_new_question" action="<c:url value='/question/saveQuestion.do'/>" method="POST" >
		<c:if test="${not empty message}">
			<div id="f_new_question_error" class="div_topic_error" style="display:block"><c:out value="${message}"/></div>
		</c:if>
		<textarea id="question_content" name="question.content" rows="200" cols="80" style="width:750px;height:400px">
			<c:out value='${question.content}'/>
		</textarea>
		<br/>
		<span>分&nbsp;&nbsp;类:</span>
		<select id="parentType" name="parentType"></select>
		<select id="questionType" name="question.type"></select>
		<br/>
		<button class="btn1" type="submit" name="submitQuestion">发表</button>
	</form>
</div>
<script>
$(document).ready(function(){
	var url = ctx + '/json/segment/get.do?module=q&level=1';
	$.getJSON(url, function(data){
		for(var i=0; i<data.segments.length;i++){
			$('#parentType').append('<option value='+data.segments[i].value+'>'+data.segments[i].text+'</option>');
		}
	});
	$('#parentType').change(function(){
		var id=$("#parentType").val();
		var url = ctx + '/json/segment/get.do?module=q&level=2&id='+id;
		$('#questionType').html('');
		$.getJSON(url, function(data){
			for(var i=0; i<data.segments.length;i++){
				$('#questionType').append('<option value='+data.segments[i].value+'>'+data.segments[i].text+'</option>');
			}
		});
	});
	setTimeout(function(){
       $("#parentType").trigger('change');
    }, 1000);
});
</script>